package cn.jofei.common.monitor.cmds;

/**
 * @author bao
 * @version project-manager v1.0
 * @description 无参数的 cmd 命令
 * @date 2021/12/27 13:32
 */
public abstract class Commands implements Shells, CMDs {
    public static String kafkaGroupsListShell(String path, String servers) {
        String cmd = "%sbin/kafka-consumer-groups.sh --bootstrap-server %s --list";
        if (!path.endsWith("/")) {
            path = path + "/";
        }
        return String.format(cmd, path, servers);
    }

    public static String kafkaGroupTopicInfoShell(String path, String servers, String group) {
        String cmd = "%sbin/kafka-consumer-groups.sh --bootstrap-server %s --describe --group %s |awk '{print $1,$5}'";
        if (!path.endsWith("/")) {
            path = path + "/";
        }
        return String.format(cmd, path, servers,group);
    }
}
